home *** CD-ROM | disk | FTP | other *** search
- $! hdecompress.com
- $!
- $! VMS command file to do H-transform image de-compression for a list of files.
- $! *.xxx_H files are replaced by *.xxx.
- $!
- $! R. White, 20 April 1992
- $!
- $! determine where this procedure lives (assume that the executable files
- $! are in this same directory)
- $!
- $ shellfile=f$parse(f$environment("procedure"),,,,"NO_CONCEAL")-"]["
- $ cdir=f$extract(0,f$locate("]",shellfile),shellfile) + "]"
- $ prgnam=f$parse(shellfile,,,"NAME")
- $!
- $ echo:=write sys$output
- $ hd:=$'cdir'hdecomp
- $!
- $ if p1.eqs.""
- $ then
- $ echo "Usage: ",prgnam," [options] files... [options] files..."
- $ echo " where options are:"
- $ echo " -s to enable smoothing"
- $ echo " -u to disable smoothing (default)"
- $ echo " -k to keep the compressed file (default)"
- $ echo " -r to remove the compressed file"
- $ echo " -o raw | net | fits | hhh to specify the output image format"
- $ echo " The default output format is raw (= hhh) unless the original"
- $ echo " image was FITS format, in which case the default is fits"
- $ echo " format."
- $ echo ""
- $ echo " Compressed files are named *.*_H; decompressed are named *.*."
- $ echo " _H should be explicitly specified at the end of the file names."
- $ exit
- $ endif
- $!
- $ remove=0
- $ smooth=""
- $ format=""
- $ nextformat=0
- $ p=1
- $ ploop:
- $ parm = p'p
- $ if parm.eqs."" then exit ! all done
- $ if nextformat.eqs.1
- $ then
- $ format=parm ! set output format
- $ nextformat=0
- $ goto endploop
- $ endif
- $ if parm.eqs."-O"
- $ then
- $ nextformat=1 ! next parameter will be output format
- $ goto endploop
- $ endif
- $ if parm.eqs."-R"
- $ then
- $ remove=1 ! remove original files
- $ goto endploop
- $ endif
- $ if parm.eqs."-K"
- $ then
- $ remove=0 ! keep original files
- $ goto endploop
- $ endif
- $ if parm.eqs."-S"
- $ then
- $ smooth="-s" ! smooth images
- $ goto endploop
- $ endif
- $ if parm.eqs."-U"
- $ then
- $ smooth="" ! don't smooth images
- $ goto endploop
- $ endif
- $!
- $! decompress the file(s) specified by this parameter
- $! use f$search to allow the use of wildcards in file specifications
- $!
- $ compfile=f$search(parm,1) ! get file name
- $ if compfile.eqs.""
- $ then
- $ echo prgnam,": ",compfile,": No such file"
- $ goto endploop
- $ endif
- $!
- $! save name of first file to correct the stupid behavior of f$search
- $! when the file argument does not contain a wildcard character
- $!
- $ firstfile=compfile
- $ floop:
- $ cext=f$parse(compfile,,,"TYPE")
- $!
- $! make sure file name ends with "_H"
- $!
- $ if f$extract(f$length(cext)-2,2,cext).nes."_H"
- $ then
- $ echo prgnam,": ",compfile,": Filename does not end in _H"
- $ goto endfloop
- $ endif
- $!
- $! remove "_H" from end of extension to get original file name
- $!
- $ dext=f$extract(0,f$length(cext)-2,cext)
- $ datafile=f$parse(dext+";",compfile,,,"SYNTAX_ONLY") ! original name
- $!
- $! if original file still exists, we'll rely on VMS to create a new version
- $!
- $!
- $! perform decompression
- $!
- $ echo datafile
- $ on warning then continue
- $ if format.nes.""
- $ then
- $ define/user sys$input 'compfile'
- $ define/user sys$output 'datafile'
- $ hd -v 'smooth' -o 'format'
- $ else
- $ define/user sys$input 'compfile'
- $ define/user sys$output 'datafile'
- $ hd -v 'smooth'
- $ endif
- $ if $status.eq.1 ! check for success
- $ then
- $ if remove.eq.1 then delete 'compfile' ! delete compressed file
- $ else
- $ echo prgnam,": error, ",compfile," not decompressed"
- $ delete 'datafile' ! delete decomp file
- $ endif
- $ endfloop:
- $!
- $! get next file name
- $!
- $! be careful: f$search returns the same name every time if there are
- $! no wildcard characters in the argument (dumb)
- $!
- $ compfile=f$search(parm,1)
- $ if compfile.nes.firstfile
- $ then
- $ if compfile.nes."" then goto floop
- $ endif
- $!
- $! go to next parameter
- $!
- $ endploop:
- $ p = p+1
- $ goto ploop
-